<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/4/1
 * Time: 下午3:38
 */

namespace app\index\controller;


use app\index\model\SubCategory;
use app\index\model\SupCategory;
use app\index\service\CategoryService;
use app\index\service\StandardService;
use think\Controller;
use think\Request;

class Standard extends BaseController
{
    public function index(){
        $category_list = CategoryService::getSupCategoryList();
        $this->assign("category_list",$category_list);

        return $this->fetch("catgrey");
    }
    
    public function getDeitail($options){
        $option_array = explode("-",$options);
        $supCateId=$option_array[0];
        $subCateId = $option_array[1];
        $supcategory_name = SupCategory::getCategoryNameById($supCateId);
        $subcategory_name = SubCategory::getCategoryNameById($subCateId);
        $standard_detail = StandardService::getStandardDetailById($supCateId,$subCateId);
        $this->assign("standard_detail",$standard_detail);
        $year = config("app.year");
        
		return $this->fetch("catgreyDetail",["supCateId"=>$supCateId,
            "subCateId"=>$subCateId,"supcategory_name"=>$supcategory_name,
            "subcategory_name"=>$subcategory_name,"year"=>$year]);
    }
    
}